package org.joe.chinachess.ui;

import org.joe.chinachess.utils.Constants;

import javax.swing.*;
import java.awt.*;

/**
 * 聊天对话框
 *
 * @author Joe
 */
public class NorthPanel extends JPanel {

    private JTextField textField = new JTextField("尚未开始游戏，请A方选择颜色。");

    public NorthPanel() {
        this.setLayout(new BorderLayout());
        this.add(this.textField, BorderLayout.NORTH);
    }

    public void updateText(int aColor, int bColor, int step) {
        StringBuffer text = new StringBuffer("A方执" + (aColor == Constants.Color.RED ? "红棋" : "黑棋") + ", ");
        text.append("B方执" + (bColor == Constants.Color.BLACK ? "黑棋" : "红棋") + ", ");
        text.append("当前轮到 " + (step % 2 == 0 ? "A方" : "B方") + "操作");
        this.textField.setText(text.toString());
    }


}
